	.data
vstart:	.word 10, 9, 8, 7, 6
	.word 5, 4, 3, 2, 1
max_id:	.word 10

	.text
troca:	addi $sp, $sp, -16
	sw	$s1, 12($sp)
	sw	$s0, 8($sp)
	sw	$v1, 4($sp)
	sw	$v0, 0($sp)

	sll	$v0, $a1, 2
	add	$v0, $a0, $v0
	lw	$s0, 0($v0)
	lw	$s1, 4($v0)
	slt	$v1, $s1, $s0
	beq	$v1, $zero, ftroca
	sw	$s1, 0($v0)
	sw	$s0,4($v0)

ftroca:	lw	$v0, 0($sp)
	lw	$v1, 4($sp)
	lw	$s0, 8($sp)
	lw	$s1, 12($sp)
	addi	$sp,$sp, 16
	jr	$ra

main:	addi	$sp, $sp, -4
	sw	$ra, 0($sp)

	add	$s7, $zero, $zero
	lw	$s6, max_id
	addi	$s6, $s6, -1
para1:	slt	$t0, $s7, $s6
	beq	$t0, $zero, fpara1

	sub	$s4, $s6, $s7
	add	$s5, $zero, $zero
para2:	slt	$t1, $s5, $s4
	beq	$t1, $zero, fpara2

	la	$a0, vstart
	add	$a1, $zero, $s5
	jal	troca

	addi	$s5, $s5, 1
	j	para2
fpara2:
	addi	$s7, $s7, 1
	j	para1
fpara1:
	lw	$ra, 0($sp)	
	addi	$sp, $sp, 4
	jr	$ra